@import 'themes';
@import 'repl-common';
@import 'highlight';
@import 'repl-output';
@import 'repl-source-file';
@import 'repl-console-environment-watcher';

@mixin replConsoleMessage($theme) {
  .repl-console-message {
    flex: 1;
    word-wrap: break-word;
    white-space: pre-wrap;
    @include fullHeight();
    overflow: auto;

    display: flex;
    flex-direction: column;

    .repl-status-bar-cover, .repl-console-message-filters {
      @include notSelectable();
    }

    .repl-console-message-filters {
      font-family: monospace;
      display: flex;
      padding: 5px 2px;
      border-bottom: 1px solid if($theme == $dark-theme, $dark-app-console-message-filter-border-color, $lt-app-console-message-filter-border-color);
      .label {
      }
      .message-filter.clear {
        display: flex;
        align-self: center;
        cursor: pointer;
      }
    }

    .repl-console-message-list {
      flex: 1;
      overflow: auto;
    }
    @include replConsoleEnvironment($theme);
    .repl-console-environment-resizeable {
      display: flex;
      height: 8px;
      width: 100%;
      position: relative;
      background-color: if($theme == $dark-theme, $dark-app-console-resize-handle-color, $lt-app-console-resize-handle-color);
      cursor: ns-resize;
      align-items: center;

      .repl-console-drag-lines {
        @include notSelectable();
        text-align: center;
        flex: 1;

        &:before {
          content: '=';
          text-align: center;
          margin: 1px;
          color: if($theme == $dark-theme, $dark-app-console-drag-lines-color, $lt-app-console-drag-lines-color);
        }
      }
    }

    .repl-console-message-entry {
      padding: 5px;
      overflow: auto;
      border-bottom: 1px solid if($theme == $dark-theme, $dark-app-console-message-entry-border-color, $lt-app-console-message-entry-border-color);

      .fa {
        padding: 0px 4px 0px 2px;
      }

      .repl-console-message-info {
        color: if($theme == $dark-theme, $dark-app-console-message-entry-info-color, $lt-app-console-message-entry-info-color);
      }

      .repl-console-message-warning {
        color: if($theme == $dark-theme, $dark-app-console-message-entry-warn-color, $lt-app-console-message-entry-warn-color);
      }

      .repl-console-message-error {
        color: if($theme == $dark-theme, $dark-app-console-message-entry-error-color, $lt-app-console-message-entry-error-color);
      }

      .repl-console-message-entry-content.log > * {
        padding: 0px 2px;
      }

      .repl-console-message-entry-content {
        @include replSourceFile($theme);
        @include replOutput($theme);

        .ellipsis {
          &:after {
            content: '\2026';
            color: if($theme == $dark-theme, $dark-app-entry-ellipsis-color, $lt-app-entry-ellipsis-color);
          }
        }

        .repl-entry-output-error {
          .repl-entry-output-error-message {
            .fa-play {
              color: if($theme == $dark-theme, $dark-app-entry-message-output-arr-fold-color, $lt-app-entry-message-output-arr-fold-color);
            }
            .repl-entry-output-error-message-heading {
              padding-left: 5px;
            }
            .syntax-error {
              .repl-entry-output-error-message-heading {
                padding-left: 0px;
              }
              .err-underline {
                text-decoration: underline;
                text-decoration-color: $app-text-error-color;
                font-size: 0.9em;
              }
            }
            .repl-entry-output-error-stack {
              .repl-entry-output-error-stack-lines {
                padding-left: calc(1em + 5px);
              }
            }
          }

          @include stackTraceHighlight($theme);
        }
      }
    }

    .repl-console-message-entry.error {

    }

    .repl-console-message-entry.warn {
      background-color: if($theme == $dark-theme, $dark-app-console-message-entry-warn-bg-color, $lt-app-console-message-entry-warn-bg-color);
    }

    .console-message-count {
      border-radius: 0.5em;
      background-color: if($theme == $dark-theme, $dark-app-console-message-dup-count-bg-color, $lt-app-console-message-dup-count-bg-color);
      color: if($theme == $dark-theme, $dark-app-console-message-dup-count-color, $lt-app-console-message-dup-count-color);
      font-family: monospace;
      width: 1.2em;
      height: 1.18em;
      display: inline-block;
      font-size: 0.85em;
      text-align: center;
      top: -2px;
      position: relative;
      margin-right: 5px;
      font-weight: 900;
      cursor: default;
    }

    .repl-console-message-entry.info {

    }
  }
}
